package ru.usu.gv.utils.generators;

import ru.usu.gv.core.I18nService;
import ru.usu.gv.graph.Graph;
import ru.usu.gv.gui.component.GVIntegerField;
import ru.usu.gv.utils.RandomUtilities;

import javax.swing.JPanel;

/**
 @author Sergey Pupyrev 
 14.05.2007
 */

public class TreeGenerator extends GraphGeneratorBase
{
    private GVIntegerField count;

    public String getTitle()
    {
        return I18nService.get("generator.tree");
    }

    public Graph generate(JPanel panel)
    {
        return RandomUtilities.generateRandomTree(count.getValue());
    }

    @Override
    public void customizePanel(JPanel panel)
    {
        super.customizePanel(panel);

        count = new GVIntegerField(I18nService.get("generator.tree.count"), 100, true);

        panel.add(count);
    }

}
